package com.caishi.lkx.order.model;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
import com.zzw.common.entity.impl.BSIntEntity;
import com.zzw.common.service.model.RouterServiceModel;
import com.caishi.lkx.order.ienum.type.PaymentType;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;

import java.time.LocalDateTime;
import java.util.Map;

/**
 * @author by keray
 * date:2021/4/20 10:24 上午
 * 支付快照
 */
@Getter
@Setter
public class IPayImageLog<T extends IPayImageLog<T>> extends BSIntEntity<T> {

    /**
     * 创建时间
     */
    private LocalDateTime createdTime;

    /**
     * 创建人
     */
    private String createBy;

    /**
     * 快照类型
     */
    private PaymentType logType;

    private String orderId;

    private Long payId;

    /**
     * 快照内容
     */
    @TableField(typeHandler = FastjsonTypeHandler.class)
    private Map<String, Object> imageData;

    @EqualsAndHashCode(callSuper = true)
    @Data
    @TableName("or_pay_image_log")
    public static class PayImageLog extends IPayImageLog<PayImageLog> implements RouterServiceModel {

    }


    @EqualsAndHashCode(callSuper = true)
    @Data
    @TableName("or_zfb_pay_image_log")
    public static class ZFBPayImageLog extends IPayImageLog<ZFBPayImageLog> {
        @TableField(exist = false)
        private PaymentType logType = PaymentType.alipay;
    }

    @EqualsAndHashCode(callSuper = true)
    @Data
    @TableName("or_weixin_pay_image_log")
    public static class WeixinPayImageLog extends IPayImageLog<WeixinPayImageLog> {
        @TableField(exist = false)
        private PaymentType logType = PaymentType.weixin;
    }

}
